Skip to content

Move output from CSV files to a SQL db#403

Open
Grufoony wants to merge 12 commits intomainfrom
db
Open

Move output from CSV files to a SQL db#403
Grufoony wants to merge 12 commits intomainfrom
db

Conversation

@Grufoony
Copy link
Collaborator

@Grufoony Grufoony commented Feb 6, 2026

TODO:

  • Save edges and nodes data in the db + find a way to identify networks.
  • Rewrite webapp to extract data from the db

dynamics.setSpeedFluctuationSTD(0.1);

// Connect database for saving data
dynamics.connectDataBase(OUT_FOLDER + "simulation_data.db");

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
dynamics.setDataUpdatePeriod(30); // Store data every 30 time steps

// Connect database for saving data
dynamics.connectDataBase(OUT_FOLDER + "simulation_data.db");

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
#ifdef __APPLE__
std::time_t const t = std::chrono::system_clock::to_time_t(now);
std::ostringstream oss;
oss << std::put_time(std::localtime(&t), "%Y%m%d%H%M%S");

Check notice

Code scanning / Cppcheck (reported by Codacy)

localtime is Y2038-unsafe Note

localtime is Y2038-unsafe
std::filesystem::remove(testFile);
SQLite::Statement cols(db,
"SELECT street_id, density, avg_speed FROM road_data");
while (cols.executeStep()) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note test

MISRA 14.4 rule
std::ifstream file(entry.path());
REQUIRE(file.is_open());
// Evolve until agent reaches destination (with limit)
for (int iter = 0; iter < 1000 && dynamics.nAgents() > 0; ++iter) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note test

MISRA 12.1 rule
break;
}
SQLite::Statement cols(db, "SELECT distance_m, travel_time_s FROM travel_data");
while (cols.executeStep()) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note test

MISRA 14.4 rule
SQLite::Statement cols(db, "SELECT distance_m, travel_time_s FROM travel_data");
while (cols.executeStep()) {
auto distance = cols.getColumn(0).getDouble();
auto time = cols.getColumn(1).getDouble();

Check notice

Code scanning / Cppcheck (reported by Codacy)

time is Y2038-unsafe Note test

time is Y2038-unsafe
auto distance = cols.getColumn(0).getDouble();
auto time = cols.getColumn(1).getDouble();
CHECK(distance > 0.0);
CHECK(time > 0.0);

Check notice

Code scanning / Cppcheck (reported by Codacy)

time is Y2038-unsafe Note test

time is Y2038-unsafe

file.close();
std::filesystem::remove(testFile);
for (int iter = 0; iter < 1000 && dynamics.nAgents() > 0; ++iter) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note test

MISRA 12.1 rule
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 89.14474% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.41%. Comparing base (0df87e6) to head (f01e859).

Files with missing lines Patch % Lines
src/dsf/mobility/FirstOrderDynamics.cpp 72.09% 12 Missing ⚠️
src/dsf/mobility/RoadDynamics.hpp 93.49% 11 Missing ⚠️
test/mobility/Test_dynamics.cpp 87.17% 0 Missing and 10 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #403      +/-   ##
==========================================
+ Coverage   85.81%   87.41%   +1.59%     
==========================================
  Files          54       53       -1     
  Lines        6190     5936     -254     
  Branches      671      657      -14     
==========================================
- Hits         5312     5189     -123     
+ Misses        862      728     -134     
- Partials       16       19       +3     
Flag Coverage Δ
unittests 87.41% <89.14%> (+1.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

/// @brief Copy assignment operator for PointsCluster.
/// @param other The PointsCluster to copy from.
/// @return Reference to this PointsCluster.
PointsCluster& operator=(PointsCluster const& other) = default;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 16.3 rule Note

MISRA 16.3 rule
cluster_radius_km,
max_speed_kph,
min_duration_min](auto& pair) {
max_speed_kph](auto& pair) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 13.1 rule Note

MISRA 13.1 rule
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

}

/* Database modal styles */
.modal {

Check warning

Code scanning / Csslint (reported by Codacy)

Rule doesn't have all its properties in alphabetical order. Warning

Rule doesn't have all its properties in alphabetical order.
display: none;
}

.modal-content {

Check warning

Code scanning / Csslint (reported by Codacy)

Rule doesn't have all its properties in alphabetical order. Warning

Rule doesn't have all its properties in alphabetical order.
text-align: center;
}

.modal-content h2 {

Check warning

Code scanning / Csslint (reported by Codacy)

Rule doesn't have all its properties in alphabetical order. Warning

Rule doesn't have all its properties in alphabetical order.
margin-bottom: 20px;
}

.db-input-group input[type="file"] {

Check warning

Code scanning / Csslint (reported by Codacy)

Rule doesn't have all its properties in alphabetical order. Warning

Rule doesn't have all its properties in alphabetical order.
border-color: #4CAF50;
}

.db-status {

Check warning

Code scanning / Csslint (reported by Codacy)

Rule doesn't have all its properties in alphabetical order. Warning

Rule doesn't have all its properties in alphabetical order.
text-align: center;
}

.modal-content h2 {

Check notice

Code scanning / Csslint (reported by Codacy)

Heading (h2) should not be qualified. Note

Heading (h2) should not be qualified.
border: 2px dashed #ccc;
border-radius: 5px;
width: 100%;
box-sizing: border-box;

Check notice

Code scanning / Csslint (reported by Codacy)

The box-sizing property isn't supported in IE6 and IE7. Note

The box-sizing property isn't supported in IE6 and IE7.
min-height: 20px;
}

.db-status.error {

Check notice

Code scanning / Csslint (reported by Codacy)

Adjoining classes: .db-status.error Note

Adjoining classes: .db-status.error
color: #c62828;
}

.db-status.success {

Check notice

Code scanning / Csslint (reported by Codacy)

Adjoining classes: .db-status.success Note

Adjoining classes: .db-status.success
color: #2e7d32;
}

.db-status.loading {

Check notice

Code scanning / Csslint (reported by Codacy)

Adjoining classes: .db-status.loading Note

Adjoining classes: .db-status.loading
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylelint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant